//package com.rp.download.controller;
//
//
//
//import com.google.common.base.Splitter;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.ListOperations;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.util.*;
//import java.util.concurrent.TimeUnit;
//
//import com.rp.download.vo.*;
//import com.rp.download.util.*;
//
//@RestController
//@Slf4j
//public class TestMain {
//
//
//
//    @Autowired
//    private RedisTemplate redisTemplate;
//
//    @GetMapping("/test1")
//    public void test1(HttpServletResponse response){
//
//
//
//        //7.3 Excel名称
//        String fileName = "白名称导入失败数据.";
//        try {
//
//            List<TestVo> convert = new ArrayList<>();
//
//            TestVo vo1 = new TestVo();
//            vo1.setAA("测试");
//            vo1.setName("姓名");
//
//            TestVo vo2 = new TestVo();
//            vo2.setAA("测试2");
//            vo2.setName("姓名2");
//
//           // convert.add(vo1);
//
//
//            ExcelUtils.exportExcel(response,fileName,convert, TestVo.class);
//
//        } catch (IOException e) {
//            log.error("导出Excel异常:",e.getMessage());
//            e.printStackTrace();
//            try {
//                response.setContentType("text/html; charset=UTF-8");//注意text/html，和application/html
//                response.getWriter().print("<html><body><script type='text/javascript'>alert('下载白名单(错误信息)异常！');</script></body></html>");
//                response.getWriter().close();
//                return;
//            } catch (IOException ioException) {
//                ioException.printStackTrace();
//            }
//        }
//    }
//
//
//    @GetMapping("/test2")
//    public void test2(HttpServletResponse response){
////        List<String> list = new ArrayList<>();
////        list.add("1");
////        list.add("2");
////        list.add("3");
////        list.add("1");
////        list.add("6");
////
////        List<String> list1 = new ArrayList<>();
////        list1.add("1a");
////        list1.add("2a");
////        list1.add("3a");
////        list1.add("1a");
////        list1.add("6a");
//
//
//      //  ListOperations listOperations = redisTemplate.opsForList();
////        listOperations.rightPush("aa1","list");
////        listOperations.rightPush("aa1","list1");
////        listOperations.rightPush("aa1","list2");
////        listOperations.rightPush("aa1","list3");
////        listOperations.rightPush("aa1","list1");
////        listOperations.rightPush("aa1","list2");
////        listOperations.rightPush("aa1","list4");
////        redisTemplate.expire("aa1",60, TimeUnit.SECONDS);
////
//
//        List<String> listb = redisTemplate.opsForList().range("aa1", 0, -1);
//        System.out.println("------------>"+listb);
//
//    }
//
//    /**
//     * 正则替换
//     * @param url
//     * @param name
//     * @param accessToken
//     * @return
//     */
//    public static String replaceAccessTokenReg(String url, String name, String accessToken) {
//        if (StringUtils.isNotBlank(url) && StringUtils.isNotBlank(accessToken)) {
//            url = url.replaceAll("(" + name + "=[^&]*)", name + "=" + accessToken);
//        }
//        return url;
//    }
//
//    public static String getParam(String url, String name) {
//        String params = url.substring(url.indexOf("?") + 1, url.length());
//        Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(params);
//        return split.get(name);
//    }
//
//
//
//    public static void main(String[] args) {
//
//        String url= "http://ets.webofknowledge.com/ETS/ets.do?mark_from=2501&product=UA&colName=WOS&displayUsageInfo=true&parentQid=23&rurl=http%253A%252F%252Fapps.webofknowledge.com%252Fsummary.do%253Fproduct%253DWOS%2526search_mode%253DGeneralSearch%2526colName%253DWOS%2526page%253D1000%2526qid%253D21%2526SID%253D6C1xH9Pr7rXWb23FKbN&mark_to=3000&filters=AUTHORS%20TITLE%20SOURCE%20CONFERENCE_INFO%20ADDRS%20CITTIMES%20ISSN%20ACCESSION_NUM%20AUTHORSIDENTIFIERS%20PMID&qid=29&SID=6C1xH9Pr7rXWb23FKbN&totalMarked=500&action=saveToFile&sortBy=PY.D;LD.D;SO.A;VL.D;PG.A;AU.A&logEventQid=23&displayTimesCited=true&displayCitedRefs=true&fileOpt=tabWinUTF8&UserIDForSaveToRID=null";
//
//
//        String mark_from = replaceAccessTokenReg(url, "mark_from", "3501");
//        String mark_to = replaceAccessTokenReg(mark_from, "mark_to", "4000");
//        System.out.println("1----->"+url);
//        System.out.println("2----->"+mark_from);
//        System.out.println("3----->"+mark_to);
//
//        String qid = getParam(mark_to, "qid");
//        System.out.println("----->"+ qid);
//
//
//    }
//}
